home *** CD-ROM | disk | FTP | other *** search
/ Exploring Aeronautics / NASA Exploring Aeronautics.iso / pc / source / start.dxr / 00001_main.ls next >
Encoding:
Text File  |  1998-06-02  |  2.1 KB  |  99 lines

  1. global gPathDelim
  2.  
  3. on startMovie
  4.   if the quickTimePresent = 0 then
  5.     qtErrorHandler()
  6.   end if
  7.   if pc() then
  8.     set gPathDelim to "\"
  9.   else
  10.     set gPathDelim to ":"
  11.   end if
  12.   if appendHardDrive("source") = 0 then
  13.     appendCdDrive()
  14.   end if
  15. end
  16.  
  17. on qtErrorHandler
  18.   if pc() then
  19.     go("qtErrorWin")
  20.   else
  21.     go("qtErrorMac")
  22.   end if
  23. end
  24.  
  25. on stopMovieScript
  26. end
  27.  
  28. on appendHardDrive aFolder
  29.   set fileList to currentFolder()
  30.   if getPos(fileList, aFolder) then
  31.     append(the searchPath, the pathName & aFolder)
  32.     return 1
  33.   else
  34.     return 0
  35.   end if
  36. end
  37.  
  38. on currentFolder aPath
  39.   if voidp(aPath) then
  40.     set currentPath to the pathName
  41.   else
  42.     set currentPath to aPath
  43.   end if
  44.   set fileList to []
  45.   repeat with fileNumber = 1 to the maxinteger
  46.     set fileName to lowercase(getNthFileNameInFolder(currentPath, fileNumber))
  47.     if fileName = EMPTY then
  48.       exit repeat
  49.     end if
  50.     append(fileList, fileName)
  51.   end repeat
  52.   return fileList
  53. end
  54.  
  55. on appendCdDrive
  56.   if pc() then
  57.     set cdDriveLetter to CheckDrive("aero32.exe")
  58.     append(the searchPath, cdDriveLetter & "\source\")
  59.   else
  60.     set cdName to "Exploring Aeronautics:"
  61.     if getNthFileNameInFolder(cdName, 1) = EMPTY then
  62.       alert("Could not find the Exploring Aeronautics CD-ROM")
  63.     else
  64.       append(the searchPath, cdName & "source:")
  65.     end if
  66.   end if
  67. end
  68.  
  69. on pc
  70.   return the machineType = 256
  71. end
  72.  
  73. on CheckDrive weirdfile
  74.   repeat with i = 66 to 90
  75.     set drive to numToChar(i)
  76.     set thisDrive to string(drive & ":\")
  77.     set thisPath to string(drive & ":\" & weirdfile)
  78.     set filesOnDrive to currentFolder(thisDrive)
  79.     if getPos(filesOnDrive, weirdfile) then
  80.       return drive & ":"
  81.       exit
  82.     end if
  83.   end repeat
  84.   alert("Could not find the Exploring Aeronautics CD-ROM")
  85. end
  86.  
  87. on lowercase whichString
  88.   set newString to EMPTY
  89.   repeat with x = 1 to length(whichString)
  90.     set thisChar to char x of whichString
  91.     set numOfChar to charToNum(thisChar)
  92.     if (numOfChar >= 65) and (numOfChar <= 90) then
  93.       set thisChar to numToChar(charToNum(thisChar) + 32)
  94.     end if
  95.     set newString to newString & thisChar
  96.   end repeat
  97.   return newString
  98. end
  99.